/**
 * @function 标签管理控制器
 * @author anytao
 * @created 2016-07-22
 * @version 1.0
 */
'use strict';

import Base from './base.js';
import request from 'request';

export default class extends Base {

    /**
     * 标签列表页面视图
     */
    indexAction() {
        this.assign('title', '标签列表');
        return this.display();
    }

    /**
     * 新建/编辑标签视图
     */
    async editAction() {

        let tagId = this.get('tagId');
        
        request('http://127.0.0.1:8360/api/tag/get?tagId=' + tagId, (error, response, body) => {
            if (!error && response.statusCode == 200) {
                this.assign('tag', JSON.parse(body));
                this.assign('title', '标签管理');
            }
            return this.display();
        });
    }
}